package com.dbappsecurity.network.client.interceptor;

import okhttp3.Interceptor;
import okhttp3.Response;

import java.io.IOException;
import java.util.Locale;

/**
 * Created by Arirus on 2017/8/18.
 */

public final class CacheInterceptor implements Interceptor {

  @Override
  public Response intercept(Chain chain) throws IOException {
    Response originalResponse = chain.proceed(chain.request());
    return originalResponse.newBuilder()
        .removeHeader("Pragma")
        .header("Cache-Control", String.format(Locale.CHINA, "max-age=%d", 60))
        .build();
  }
}
